<template>
	<view>
		<uni-search-bar v-model="form.noticeTitle" bgColor="white" @confirm="getNoticeList"></uni-search-bar>
		<uni-list :border="true">
			
			<uni-row>
				<uni-col :span="24" v-for="(item,index) in dataList" :key="item.noticeId" >
					<view class="list-box" @click="toNotice(item.noticeId)">
						<uni-col :span="5">
							<view class="list-box-image">
								<image :src="imageBaseUrl + item.mainImage"></image>
							</view>
						</uni-col>
						<uni-col :span="19">
							<view class="list-box-text">
								<uni-col :span="24">
									<view class="list-box-title">{{item.noticeTitle}}</view>
								</uni-col>
								<uni-col :span="24">
									<view class="list-box-other">{{parseTime(item.createTime, '{y}.{m}.{d}')}}</view>
								</uni-col>
							</view>
						</uni-col>
					</view>
					
				</uni-col>
				
			</uni-row>
			
		</uni-list>
	</view>
</template>

<script>
	import {image_base_url,base_url} from '@/api/config.js'
	export default {
		data() {
			return {
				imageBaseUrl: image_base_url,
				baseUrl : base_url,
				dataList:[],
				form:{
					noticeTitle :undefined,
					noticeType: 2,
					pageNum: 1,
					pageSize: 100
				}
			}
		},
		onShow() {
			this.getNoticeList()
		},
		methods: {
		
			getNoticeList() {
				this.$http({
					url: '/system/notice/list',
					method: 'get',
					params: this.form
				}).then(res => {
					this.dataList = res.rows;
				});
			},
			toNotice(noticeId){
				uni.navigateTo({
					url: '/pages/notice/notice/notice?noticeId='+encodeURIComponent(noticeId)
				})
			},
		}
	}
</script>

<style lang="scss">
.list-box{
	border-bottom: solid 1rpx #eee;
}
.list-box-image{
	height: 120rpx;
	width: 120rpx;
	margin: 24rpx;
	border: solid 1rpx #eee;
	image{
		width: 100%;
		height: 100%;
		margin:2rpx;
	}
}
.list-box-text{
	height: 120rpx;
	margin-top: 24rpx;
	margin-left: 10rpx;
	margin-right: 20rpx;
}
.list-box-title{
	height: 90rpx;
	line-height: 45rpx;
	letter-spacing: 2rpx;
}
.list-box-other{
	height: 40rpx;
	line-height: 40rpx;
	color:#999;
	font-size: 24rpx;
}

</style>
